package com.itheima.service.impl;

import com.itheima.bean.Student;
import com.itheima.mapper.StudentMapper;
import com.itheima.service.StudentService;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class StudentServiceImpl implements StudentService {

    private StudentMapper mapper;//注入的是mapper的代理对象

    public void setMapper(StudentMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public List<Student> selectAll() throws IOException {
        return mapper.selectAll();
    }

    @Override
    public Student selectById(Integer id) throws IOException {
        return mapper.selectById(id);
    }

    @Override
    public Integer insert(Student stu) throws IOException {
        return mapper.insert(stu);
    }

    @Override
    public Integer update(Student stu) throws IOException {
        return mapper.update(stu);
    }

    @Override
    public Integer delete(Integer id) throws IOException {
        return mapper.delete(id);
    }
}
